// 保存token到localStorage
export const setToken = (token) => {
  localStorage.setItem('token', token)
}

// 从localStorage获取token
export const getToken = () => {
  return localStorage.getItem('token')
}

// 清除token
export const removeToken = () => {
  localStorage.removeItem('token')
}

// 保存用户信息
export const setUser = (user) => {
  localStorage.setItem('user', JSON.stringify(user))
}

// 获取用户信息
export const getUser = () => {
  const user = localStorage.getItem('user')
  return user ? JSON.parse(user) : null
}

// 清除用户信息
export const removeUser = () => {
  localStorage.removeItem('user')
}

// 清除所有认证信息
export const clearAuth = () => {
  removeToken()
  removeUser()
} 